import React, { useRef, useState, useEffect } from 'react';
import { connect, history } from 'umi';
import { Row, Col, Card, Tooltip, Button, Space, Modal, notification } from 'antd';
import TableDataBlock from '@/components/TableDataBlock';
import { uploadFile, } from '@/utils/utils'
import request from 'axios';
const AnsweringnUserNumber = (props) => {
    const { loading, dispatch, list, } = props;
    const childRef = useRef();
    const { location = {} } = history;
    const { pathname, query } = location;
    const { accessId, id } = query;
    const searchItems = [
        {
            label: '明细类型',
            name: 'addType',
            type: 'select',
            select: {
                add: '增加',
                minus: '扣除'
            }
        },

    ];
    const getColumns = [
        {
            title: '明细类型',
            dataIndex: 'addType',
            render: (e) => {
                return {
                    add: '增加',
                    minus: '扣除'
                }[e]
            }
        },
        {
            title: '原因',
            dataIndex: 'content',
        },
        {
            title: '次数',
            dataIndex: 'amount',
        },
        {
            title: '时间',
            dataIndex: 'createTime',

        },
    ];
    const handleCallback = () => {
        childRef.current.fetchGetData();
    };

    return <Card
        title={'次数明细'}>
        <TableDataBlock
            searchItems={searchItems}
            cRef={childRef}
            loading={loading}
            columns={getColumns}
            params={{
                organizationUserId: id
            }}
            rowKey={(e) => {
                return e.id
            }}
            dispatchType="answering/fetchListQaAmountRecord"
            {...list}
        ></TableDataBlock>

    </Card>
}
export default connect(({ loading, answering }) => ({
    list: answering.userQaAmountRecordList,
}))(AnsweringnUserNumber);
